<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    header {
      width: 375px;
      height: 60px;
      font-size: 20px;
      background-color: lightcoral;
      display: flex;
      justify-content: center;
      align-items: center;
    }
  </style>
</head>
<body>
  <div id="app">
    <h2>具名插槽</h2>
    <!-- 如果一个子组件要插入多块内容，使用具名插槽 -->
    <!-- 在子组件标签里面，要给每一部分的内容添加template标签，同时加上v-slot:插槽名 -->
    <!-- 子组件的slot标签要加name属性，和v-slot冒号后面的名字对应上 -->

    <!-- v-slot可以缩写成# -->
    <my-header>
      <template v-slot:back>
        <span>⚽</span>
      </template>
      <template #menu>
        <span>🏀</span>
      </template>
    </my-header>
  </div>

  <script src="../vue3.js"></script>
  <script>
    const {createApp} = Vue;

    const MyHeader = {
      template: `
        <header>
          <slot name="back"></slot>
          <span>猫眼电影</span>  
          <slot name="menu"></slot>
        </header>
      `
    }

    const app = createApp({
      components: {
        MyHeader
      },
    });

    app.mount("#app");
  </script>
</body>
</html>